// Day1 :
// 1.手写算法
// https://leetcode-cn.com/problems/add-to-array-form-of-integer/

/**
* @param {number[]} num
* @param {number} k
* @return {number[]}
*/
var addToArrayForm = function (num, k) {
    return ((BigInt(num.join('')) + BigInt(k)) + '').split('')
};

// 2.编程题
//1.手写函数柯里化
function curry(func) {
    //此处补全
    return function temp(...args) {
        if (args.length >= func.length) {
            return func.apply(this, args)
        } else {
            return function (...args2) {
                return temp.apply(this, args.concat(args2))
            }
        }
    }
}
function sum(a, b, c) {
    return a + b + c;
}
let curriedSum = curry(sum);

console.log(curriedSum(1, 2, 3)); // 6, still callable normally
console.log(curriedSum(1)(2, 3)); // 6, currying of 1st arg
console.log(curriedSum(1)(2)(3)); // 6, full currying

          // 算法目标：10分钟之内运行完成
          // 手写目标：5分钟运行完成